<template>
    <div>
        <Table border ref="selection" :columns="columns4" :data="data1"></Table>
        <Button @click="handleSelectAll(true)">Set all selected</Button>
        <Button @click="handleSelectAll(false)">Cancel all selected</Button>
        <Button type="primary" @click="getAllSubject">Primary99</Button>
    </div>
</template>
<script>
import axiosq from '@/libs/api.request.js'
export default {
    data () {
        return {
            columns4: [
                {
                    type: 'selection',
                    width: 60,
                    align: 'center'
                },
                {
                    title: '课程名',
                    key: 'title'
                },
                {
                    title: '父类',
                    key: 'parentId'
                },
                {
                    title: '创建时间',
                    key: 'gmtCreate'
                },
                {
                    title: '修改时间',
                    key: 'gmtModified'
                }
            ],
            data1: [
                
            ]
        }
    },
    
    methods: {
        handleSelectAll (status) {
            this.$refs.selection.selectAll(status);
        },

        //获取课程列表
        getAllSubject(){
            axiosq.request({
                url:'/subject/queryAll',
                method: "get"
            }).then((res)=>{
                this.data1=res.data.data
            })
        }
    }
}
</script>
